import request from '../request.js'

// 请求地址列表
function queryAddressList(data) {
	return request({
		url: '/address',
		method: 'GET',
		data
	})
}

// 添加地址
function createAddress(data) {
	return request({
		url: '/address',
		method: 'POST',
		data
	})
}

// 修改地址
function updateAddress(data) {
	return request({
		url: '/address',
		method: 'PUT',
		data
	})
}

// 删除地址
function removeAddress(data) {
	return request({
		url: '/address',
		method: 'DELETE',
		data
	})
}

// 查询地址详情
function queryAddressDetails(data) {
	return request({
		url: '/address/detail',
		method: 'GET',
		data
	})
}

// 设为默认地址
function updateDefault(data) {
	return request({
		url: '/address/default',
		method: 'POST',
		data
	})
}

export default {
	queryAddressList,
	createAddress,
	updateAddress,
	updateAddress,
	removeAddress,
	queryAddressDetails,
	updateDefault
}